#include "StdAfx.h"


// TODO: reference additional headers your program requires here
#include "Graph.h"
#include "HLS.h"
#include "FuncTimer.h"

#include <set>


Graph::Graph( void )
{
	operations.clear();
	dependencies.clear();
	sourceOps.clear();
	sinkOp.clear();
}


Graph::~Graph( void )
{
}

void Graph::initGraph()
{
    for( set<Operation*>::const_iterator it = this->operations.begin(); it != this->operations.end(); it++ )
    {
        Operation * op = ( *it );
        this->sinkOp.insert( op );
        this->sourceOps.insert( op );
    }

    for( set<Dependency*>::const_iterator it = this->dependencies.begin(); it != this->dependencies.end(); it++ )
    {
        Dependency * dep = ( *it );
        this->sinkOp.erase( dep->source );
        this->sourceOps.erase( dep->sink );
    }
}
